<template>
  <div class="lz-table-wrapper">
    <!--搜索部分-->
    <div ref="actionBarRef" class="top-module action-bar">
      <div class="action-bar-left">

        <div class="action-bar-item">
          <Button class="lz-btn lz-btn-primary" type="primary" @click="addLesson()">添加</Button>
        </div>
        <div class="action-bar-item">
          <div class="action-bar-item-title">课程名</div>
          <Input></Input>
        </div>

        <div class="action-bar-item">
          <Button class="lz-btn" type="primary" @click="getLessonList(true)">搜索</Button>
        </div>
      </div>
    </div>
    <div class="table-module" ref="cTableCardRef">
      <Table
          class="lz-table"
          :max-height="tableHeight"
          :columns="columns"
          ref="tableListRef"
          @on-select-all="selectAllRow"
          @on-select-all-cancel="cancelAllRow"
          @on-select="selectRow"
          @on-select-cancel="cancelRow"
          :data="dataList"
          :highlight-row="true"
          :loading="loading"

      >
        <template #action="{ row }">
          <ButtonGroup class="lz-btn-group">
            <Button size="small" class="lz-btn-link" @click="openDetail(row,operate.SHOW)">
              <span class="lz-color-primary">查看</span>
            </Button>
          </ButtonGroup>
        </template>
      </Table>
    </div>
    <score-detail ref="scoreDetailRef"></score-detail>
    <Page
        id="page"
        size="small"
        class="lz-page"
        show-elevator
        show-sizer
        :page-size="pageSize"
        :current="pageIndex"
        :total="total"
        show-total
        @on-change="changePageIndex"
        @on-page-size-change="changePageSize"
    />
  </div>

</template>

<script setup>
import ScoreDetail from "./score-detail.vue";
import config from '@/config'
const {operate}=config.setting

/**
 * 成绩列表部分*/
import {useLessonList} from '@/module-demo/scoreManage/hook/lessonList.js'

const {
  tableHeight,
  pageSize,
  loading,
  dataList,
  total,
  columns,
  pageIndex,
  tableListRef,
  cTableCardRef,
  actionBarRef,
  getLessonList,
  addLesson
} = useLessonList()

/**
 * 列表action操作*/
import {useTableAction} from "@/module-demo/scoreManage/hook/tableAction.js";
const {
  scoreDetailRef,
  openDetail
}=useTableAction()



/**
 * 列表通用操作*/
import {useTableHandle} from "@/module-demo/scoreManage/hook/tableHandle.js";

const{
  selectedRows,
  selectAllRow,
  cancelAllRow,
  selectRow,
  cancelRow,
  changePageIndex,
  changePageSize,
  deleteRows,
}=useTableHandle(getLessonList,{
  pageSize,
  pageIndex
})

/**
 * 成绩列表操作按钮部分*/
</script>

<style scoped>

</style>